﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace FirmaTransportowa
{
    public partial class DriverPanelForm : Form
    {
        private DriverPanelPresenter presenter;

        public DriverPanelForm(DriverPanelPresenter presenter)
        {
            InitializeComponent();
            this.presenter = presenter;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            driverDateAndTime.Text = DateTime.Now.ToString();
        }

        private void beginTransport_Click(object sender, EventArgs e)
        {
            presenter.showBeginTransportView();
        }

        private void myTransports_Click(object sender, EventArgs e)
        {
            presenter.showTransportsListView();
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                Application.Exit();
            }
        }

        private void actualTransport_Click(object sender, EventArgs e)
        {
            presenter.showActualTransportView();
        }

        private void logout_Click(object sender, EventArgs e)
        {
            presenter.clean();
            LoginPresenter.showLoginView();
        }

        private void DriverPanelForm_HelpButtonClicked(object sender, CancelEventArgs e)
        {
            HelpUtils.showHelp(this, 6);
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.F1)
            {
                HelpUtils.showHelp(this, 6);
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}